package com.shuoren.roomtemperaturecloud.repository;

import java.util.Calendar;

import javax.xml.crypto.KeySelector.Purpose;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Repository;

import com.shuoren.roomtemperaturecloud.entity.Feedback;

/**
 * @Author: Yann
 * @Date: 2019/1/10 13:22
 */
@Repository
public class FeedbackRepository {

	@Autowired
	MongoTemplate mongoTemplate;

	public Boolean saveFeedback(String userid, String context) {
		Boolean flag=false;
		Feedback feedback=new Feedback();
		feedback.setUserid(userid);
		feedback.setContent(context);
		
		feedback.setDatatime(Calendar.getInstance().getTimeInMillis());
		Feedback returnFeedback=mongoTemplate.insert(feedback);
		
		if(returnFeedback!=null) {
			flag=true;
		}
		return flag;
	}
}
